package com.wzp.yyptproject.controller;


import com.wzp.yyptproject.entity.Doctor2;
import com.wzp.yyptproject.entity.PbAmDate;
import com.wzp.yyptproject.entity.PbDate;
import com.wzp.yyptproject.repository.PbAmDateRepository;
import com.wzp.yyptproject.repository.PbDateRepository;
import com.wzp.yyptproject.service.PbAmDateService;
import com.wzp.yyptproject.service.PbDateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@CrossOrigin
@RequestMapping("pbamdate")
public class PbAmDateController {
    @Autowired
    private PbAmDateService pbAmDateService;
    @Autowired
    private PbAmDateRepository pbAmDateRepository;
    @PostMapping("findAndBytDate")
    public List<PbAmDate> findAndBytDate(@RequestBody Doctor2 doctor2){
        Integer did = doctor2.getDDid();
        System.out.println(doctor2.getDDid());
        List<PbAmDate> yyDate = pbAmDateService.findAllByDDid(did);
     return yyDate;

    }
    @GetMapping("findAlltDate")
    public List<PbAmDate> findAll() {
        List<PbAmDate> pbDateList = pbAmDateService.findAll();
        return pbDateList;
    }
}



